import { createApp } from "vue";
import { createPinia } from "pinia";
// import "@/style/index.css";
// https://arco.design/
import App from "./App.vue";
import router from "./router";
import ArcoVue from "@arco-design/web-vue";
import { Message, Notification } from "@arco-design/web-vue";
import VXETable from "vxe-table";
//vxetable 样式文件
import "vxe-table/lib/style.css";
// ArcoVue 默认 样式文件
// import "@arco-design/web-vue/dist/arco.css";
// 自定义全局样式
import "@/style/index.less";
// css动画库
import "animate.css";

import '@/utils/request.js'

// 主题文件
// import '@arco-themes/vue-taolu-publishing-platform/index.less';
async function importCss() {
  const styleDefine = localStorage?.getItem("GLOBAL_THEME") || null; //缓存的变量
  let loadStyle;
  if (styleDefine === "blue") {
    loadStyle = await import("@arco-design/web-vue/dist/arco.css");
  } else if (styleDefine === "orange") {
    loadStyle = await import("@arco-themes/vue-chengsezhuti/index.less");
  } else {
    loadStyle = await import(
      "@arco-themes/vue-taolu-publishing-platform/index.less"
    );
  }
  return loadStyle;
}
importCss();
import HighchartsVue from 'highcharts-vue'
const app = createApp(App);
function useTable(app) {
  app.use(createPinia());
  app.use(router);
  app.use(ArcoVue);
  app.use(VXETable);
  app.use(HighchartsVue)
  app.config.globalProperties.$Message = Message;
  app.config.globalProperties.$Notification = Notification;
  app.config.globalProperties.$importCss = importCss;
  // 给 vue 实例挂载内部对象，例如：
  // app.config.globalProperties.$XModal = VXETable.modal
  // 在vue文件中导入 vue 解构出 getCurrentInstance 方法 调用后可获取
}
app.use(useTable);
app.mount("#app");
